import {useState} from "react";

export default function useModal(){
    const [isModalOpen, setIsModalOpen] = useState(false);
    // 呼叫类型
    const [callType, setCallType] = useState<'INCOMING_CALL' | 'OUTGOING_CALL' | ''>('');
    // 是否接通
    const [inCall, setInCall] = useState<boolean>(false);
    // 呼叫信息
    const [callInfo, setCallInfo] = useState<{phone: string}>({phone:''});
    // 是否静音
    const [mute, setMute] = useState(false);
    // 是否通话保持
    const [hold, setHold] = useState(false);
    const showModal = () => {
        setIsModalOpen(true);
    };

    const hideModal = () => {
        setIsModalOpen(false);
        setCallType('')
        setInCall(false)
    };
    return {
        isModalOpen,
        showModal,
        hideModal,
        setCallType,
        callType,
        inCall,
        setInCall,
        callInfo,
        setCallInfo,
        mute,
        setMute,
        hold,
        setHold
    }
}
